package com.realtyManage.springboot.Dao;


import com.realtyManage.springboot.Model.Do.Appointment;
import com.realtyManage.springboot.Model.Do.AppointmentIndex;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import javax.transaction.Transactional;
import java.util.List;

/**
 * 预约信息首页
 *
 * @author 杭州素色网络科技有限公司
 * @since 2019-12-13
 */

@Repository
public interface AppointmentIndexRepository extends JpaRepository<AppointmentIndex, Integer>, JpaSpecificationExecutor<AppointmentIndex> {

    /*@Transactional
    @Modifying
    @Query(value="delete appointment where id in (?1) ",nativeQuery=true)
    int deleteAppointment(String areaId);*/

    @Query(value = "select * from appointment_index ORDER BY id DESC LIMIT 1",nativeQuery = true)
    List<AppointmentIndex> queryAppointmentIndex();

    @Query(value = "select * from appointment_index where id = ?1 ORDER BY id DESC LIMIT 1",nativeQuery = true)
    AppointmentIndex getAppointmentIndex(Integer id);
}
